//
//  WinCellTableViewCell.m
//  CarTown
//
//  Created by xionghao on 15/8/6.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "WinCellTableViewCell.h"
#import "WinModel.h"
#import <UIImageView+WebCache.h>

#define SmallFont [UIFont systemFontOfSize:12]
#define XSmallFont [UIFont systemFontOfSize:11]
#define NormalFont [UIFont systemFontOfSize:13]
#define kTableTopBorderWidth 5
@implementation WinCellTableViewCell

+(instancetype)cellWithTableview:(UITableView *)tablview{
    WinCellTableViewCell *cell=[tablview dequeueReusableCellWithIdentifier:@"wincell"];
    if (cell==nil) {
        [tablview registerNib:[UINib nibWithNibName:NSStringFromClass([self class]) bundle:nil] forCellReuseIdentifier:@"wincell"];
        cell=[tablview dequeueReusableCellWithIdentifier:@"wincell"];
    }
        return cell;
}
- (void)awakeFromNib {
    // Initialization code
}
-(void)setMode:(WinModel *)mode{
    _mode=mode;
    float pro=(86400-[_mode.last_time integerValue])/86400.0f;
    [self.progress setProgress:pro animated:YES];
    [self.icon sd_setImageWithURL:[NSURL URLWithString:[NSString getImageURLstr:_mode.brand_logo]] placeholderImage:[UIImage imageNamed:@"placehoder"]];
    self.pinpai.text=_mode.brand_id;
    self.winnumber.text=_mode.ID;
   NSInteger hours = [_mode.last_time integerValue]/3600;
    self.time.text=[NSString stringWithFormat:@"剩余时间:%ld小时",hours];
    self.price.text=[NSString stringWithFormat:@"%@万",_mode.price];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setFrame:(CGRect)frame{
    frame.origin.y += kTableTopBorderWidth;
    frame.size.height -= kTableTopBorderWidth;
    
    [super setFrame:frame]; }
@end
